<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr1 =[
            {
                name:'小红',
                age:17
            },{
                name:'小绿',
                age:17
            },
            {
                name:'小子',
                age:16
            },
            {
                name:'小头',
                age:18
            },
        ]
        function equarArr(arr,value){
            let reArr = []
            let reobj = {}
            for(let i=0;i<arr.length;i++){
                let item = arr[i][value]
                if(!reobj[item]){
                    reobj[item]=item
                    reArr.push(arr[i])
                }
            }
            return reArr
        }
        console.log(equarArr(arr1,'age'))
    </script>
</body>
</html>